﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using ManagerServices.Controller;
using ManagerServices.Entity;


namespace ManagerServices.Services
{
    /// <summary>
    /// Summary description for UserServices
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class UserServices : System.Web.Services.WebService
    {

        [WebMethod]
        public string CreateAccount(string fullname , string mail , string password, string gender , string birthday  ){

            UserProfileController newaccount = new UserProfileController();
            UserEntity newUserinfo = new UserEntity();
            ProfileEntity newprofileinfo = new ProfileEntity();
            int newid = 0;
            
            newUserinfo.MAIL = mail;
            newUserinfo.PASSWORD = password;
            newUserinfo.ID_PROFILE = newid;
            newUserinfo.DATECREATE = DateTime.Now;
            newUserinfo.DATEUPDATE = DateTime.Now;
            
            newprofileinfo.FULLNAME = fullname;
            newprofileinfo.NAME = fullname;
            newprofileinfo.GENDER = gender;
            newprofileinfo.DIRTHDAY = Convert.ToDateTime( birthday);
            newprofileinfo.DATECREATE = DateTime.Now;
       


            return newaccount.CreateAccount(newUserinfo, newprofileinfo);
        }
    }
}
